package com.bjsxt.livegoods.dao.feedback;

import com.bjsxt.livegoods.entity.Feedback;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;

import java.util.List;

public class FeedbackDaoImpl implements FeedbackDao{
    @Autowired
    private MongoTemplate mongoTemplate;
    @Override
    public void insertFeedback(Feedback feedback) {
        mongoTemplate.insert(feedback);
    }

    @Override
    public List<Feedback> findFeedback(Query query) {
        return mongoTemplate.find(query,Feedback.class);
    }

    @Override
    public long count(Query query) {
        return mongoTemplate.count(query,Feedback.class);
    }

    public MongoTemplate getMongoTemplate() {
        return mongoTemplate;
    }

    public void setMongoTemplate(MongoTemplate mongoTemplate) {
        this.mongoTemplate = mongoTemplate;
    }
}
